package com.gitee.l0km.codegen.thrift.metadata;

import com.gitee.l0km.codegen.annotations.CodegenRequired;
import com.gitee.l0km.xthrift.base.metadata.DecoratorThriftFieldMetadata;
import com.gitee.l0km.xthrift.base.metadata.ThriftFieldMetadataUtil;
import com.google.common.base.Predicate;

public class CodegenRequirednessFilter implements Predicate<DecoratorThriftFieldMetadata> {
	public static final CodegenRequirednessFilter REQUIREDNESS_FILTER= new CodegenRequirednessFilter();
	public CodegenRequirednessFilter() {
	}

	 @Override
	public boolean apply(DecoratorThriftFieldMetadata input) {
		CodegenRequired ann = ThriftFieldMetadataUtil.extractFieldAnnotation(input,CodegenRequired.class);
		if(ann != null){
			return ann.value();
		}
		return false;
	}

}
